home *** CD-ROM | disk | FTP | other *** search
- GAMMA(3M) Last changed: 2-2-99
-
-
- NNAAMMEE
- llggaammmmaa, ggaammmmaa, llggaammmmaall, ggaammmmaall - log gamma function
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<mmaatthh..hh>>
-
- ddoouubbllee ggaammmmaa((ddoouubbllee _x));;
- ddoouubbllee llggaammmmaa((ddoouubbllee _x));;
- lloonngg ddoouubbllee ggaammmmaall((lloonngg ddoouubbllee _x));;
- lloonngg ddoouubbllee llggaammmmaall((lloonngg ddoouubbllee _x));;
-
- eexxtteerrnn iinntt ssiiggnnggaamm;;
- eexxtteerrnn iinntt ssiiggnnggaammll;;
-
- IIMMPPLLEEMMEENNTTAATTIIOONN
- IRIX systems
-
- DDEESSCCRRIIPPTTIIOONN
- llggaammmmaa and ggaammmmaa return llnn||GGAAMMMMAA((_x))|| where GAMMA is the mathematical
- gamma function.
-
- ggaammmmaall and llggaammmmaall are the long double versions of the lloogg ggaammmmaa
- function.
-
- ggaammmmaa and llggaammmmaa are identical, as are ggaammmmaall and llggaammmmaall.
-
- The external integer ssiiggnnggaamm returns the sign of GGAAMMMMAA((_x)), and the
- external integer ssiiggnnggaammll returns the sign of GGAAMMMMAALL((_x)).
-
- NNOOTTEESS
- Do _n_o_t use the following expression to compute gg ::==GGAAMMMMAA((_x)):
-
- signgam * exp(gamma(x))
-
- Instead, use a program similar to the following (in C):
-
- lg = gamma(x); g = signgam*exp(lg);
-
- Only after ggaammmmaa has returned can ssiiggnnggaamm be correct. Note too that
- GGAAMMMMAA((_x)) must overflow when _x is large enough, and is undefined when _x
- is a nonpositive integer.
-
- Analogous rules apply to ggaammmmaall and ssiiggnnggaammll.
-
- The following C program fragment might be used to calculate GG if the
- overflow needs to be detected:
-
- if ((y = gamma(x)) > LN_MAXDOUBLE)
- error();
- y = signgam * exp(y);
-
- where LLNN__MMAAXXDDOOUUBBLLEE is the least value that causes eexxpp to overflow and
- is defined in the <<vvaalluueess..hh>> header file.
-
- The name GGAAMMMMAA was attached to llnn GG only in the UNIX math library for
- C. Elsewhere (in some FORTRAN libraries) the name GGAAMMMMAA belongs to GG
- and the name AALLGGAAMMMMAA to llnn GG in single precision; in double
- precision, the usual names are DDGGAAMMMMAA and DDLLGGAAMMMMAA in FORTRAN.
-
- ggaammmmaa in C originally delivered llnn((GG((xx)))). Later, the program ggaammmmaa
- was changed to handle negative arguments in a more conventional way.
- The most recent changes correct inaccurate values when _x is almost a
- negative integer.
-
- Some math libraries have changed the name of this function to llggaammmmaa(())
- to suggest its real functionality.
-
- On SGI systems, the name ggaammmmaa is currently maintained as a synonym to
- llggaammmmaa for compatibility.
-
- llggaammmmaa and ggaammmmaa are not ANSI-C functions. If you compile with the
- --aannssii or --aannssiippoossiixx options, you must supply your own prototypes for
- these functions or you will get incorrect results. (See the
- prototypes defined in //uussrr//iinncclluuddee//mmaatthh..hh).
-
- RREETTUURRNN VVAALLUUEESS
- Functions in the standard math library lliibbmm..aa, are referred to as --llmm
- versions. Those in math library lliibbmmxx..aa are referred to as --llmmxx
- versions. Those in the the BSD math library lliibbmm4433..aa are referred to
- as --llmm4433 versions. The --llmm and --llmmxx versions always return the
- default Quiet NaN and set _e_r_r_n_o to EDOM when a NaN is used as an
- argument. A NaN argument usually causes the --llmm4433 versions to return
- the same argument. The --llmm4433 versions never set _e_r_r_n_o. The value of
- HHUUGGEE__VVAALL is IEEE Infinity.
-
- The ggaammmmaa functions return HHUUGGEE__VVAALL when the argument is zero or a
- negative integer. The --llmm and --llmmxx versions also set eerrrrnnoo to EDOM.
-
- When the correct value would overflow, the ggaammmmaa functions return
- HHUUGGEE__VVAALL. The --llmm and --llmmxx versions also set _e_r_r_n_o to ERANGE.
-
- See mmaatthheerrrr(3M) for a description of error handling for --llmmxx
- functions.
-
- SSEEEE AALLSSOO
- mmaatthh(3M), mmaatthheerrrr(3M)
-
- This man page is available only online.
-